package com.skygrass.caesar.provider.mq;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.stereotype.Component;

@Component
public class MessageSender
{
	@Autowired
	@Qualifier("go-to-shanghai")
	MessageChannel goShangHai;

	@Autowired
	@Qualifier("go-to-beijing")
	MessageChannel goBeiJing;

	public String goShangHai()
	{
		goShangHai.send(MessageBuilder.withPayload("go to shang hai").build());
		return "shanghai OK";
	}

	public String goBeiJing()
	{
		goBeiJing.send(MessageBuilder.withPayload("go to bei jing").build());
		return "beijing OK";
	}
}
